package com.unme.controller;

import com.unme.model.User;
import org.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;


@CrossOrigin(maxAge = 3600)
@Controller
@RequestMapping("/api")
public class Customer {



    @CrossOrigin(origins = "*")
    @RequestMapping(value = "/addUser2", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
    @ResponseBody
    public Map<String,Object> addUser(@RequestBody JSONObject jsonParam, HttpServletResponse httpResponse) {

        User user=new User();
        Map<String,Object> map=new HashMap<>();
        try{
            map.put("message","数据保存成功！");
            return map;
        }catch (Exception e){
            e.printStackTrace();
            map.put("message","数据保存失败！");
            return map;

        }
    }
}
